{% extends 'backend_layout.html' %}

{% block css %}
    <link rel="stylesheet" href="/static/plugins/kindeditor/themes/default/default.css"/>
{% endblock %}

{% block conent %}
    <ol class="breadcrumb" style="margin-bottom: 0;">
        <li><a href="#">文章管理</a></li>
        <li class="active">创建文章</li>
    </ol>
    <div style="padding: 5px 8px;">
        <form action="/backend/add-article.html" method="post">
        {% csrf_token %}
            <div class="form-group">
                <label for="title">标题</label>
                {{ form_obj.title }}
            </div>
            <div class="form-group">
                <label for="title">简介</label>
                {{ form_obj.summary }}
            </div>
            <div class="form-group">
                <label for="content">内容</label>
                {{ form_obj.content }}
            </div>
            <div class="form-group">
                <label for="types">类型</label>

                <div>
                    {% for row in form_obj.article_type %}
                        <label class="radio-inline">
                            {{ row }}
                        </label>
                    {% endfor %}
                </div>

            </div>
            <div class="form-group">
                <label for="category">分类</label>

                <div>
                    {% for row in form_obj.category %}
                        <label class="radio-inline">
                            {{ row }}
                        </label>
                    {% endfor %}
                </div>
            </div>
            <div class="form-group">
                <label for="category">标签</label>

                <div>
                    {% for row in form_obj.tag %}
                        <label class="checkbox-inline">
                            {{ row }}
                        </label>
                    {% endfor %}
                </div>
            </div>
            <div class="form-group">
                <input type="submit" class="btn btn-primary" value="保存"/>

            </div>
        </form>
    </div>


{% endblock %}

{% block js %}
    <script charset="utf-8" src="/static/plugins/kindeditor/kindeditor-min.js"></script>
    <script charset="utf-8" src="/static/plugins/kindeditor/lang/zh_CN.js"></script>
    <script>
        var editor;
        KindEditor.ready(function (K) {
            editor = K.create('textarea[name="content"]', {
                resizeType: 1,
                uploadJson: '/backend/upload_file/',
                extraFileUploadParams: {
                csrfmiddlewaretoken: "{{ csrf_token }}"}
            });
        });
    </script>
{% endblock %}